<!DOCTYPE html>
<html>
    <head>
        <title>Preview Display</title>
        <meta charset="UTF-8">
        <link rel="shortcut icon" href="custom/images/favicon.ico?v=2" />
        <style>
            html, body {
                padding: 0px;
                margin: 0px;
            }
        </style>

		<script src='../libs/core/IZrowIfUVaXF.js'></script>
		<script src='../libs/core/VT3MIEkV8AKv.js'></script>
		<script src='../libs/core/ht.js'></script>
		<script src='../libs/core/buckle.js'></script>
		<script src='../libs/core/ht-ui.js'></script>
	
		<script src='../libs/plugin/ht-edgetype.js'></script>
		<script src="../libs/plugin/ht-obj.js"></script>
		<script src='../libs/plugin/ht-form.js'></script>
		<script src='../libs/plugin/ht-vector.js'></script>
		<script src='../libs/plugin/ht-animation.js'></script>
	
		<script src='../configs/htconfig.js'></script>
		<script src="../libs/echarts.min.js"></script>
		<script src='../libs/echarts.js'></script>
		<script src='../libs/jquery-3.4.1.min.js'></script>
		<script src='../libs/echarts.js'></script>
		<script src='../libs/buckle.js'></script>
		<script src='../libs/knU3sXefAa5Q.js'></script>
		<script src="../configs/urlConfig.js"></script>

        <script>
			
		//displays/冀北/预警级别色条.json
            function init() {
                dataModel = new ht.DataModel();
                graphView = new ht.graph.GraphView(dataModel);
                graphView.addToDOM();
                graphView.deserialize('displays/冀北/预警级别色条.json', function(json, dm, gv, datas) {
					createNodes(dm);
                    if(json.title) document.title = json.title;
                    if (json.a['json.background']) {
                        var bgJSON = json.a['json.background'];
                        if (bgJSON.indexOf('displays') === 0) {
                            var bgGv = new ht.graph.GraphView();
                            bgGv.deserialize(bgJSON);
                            bgGv.addToDOM();
                            graphView.addToDOM(bgGv.getView());
                        }
                        else if (bgJSON.indexOf('scenes') === 0) {
                            var bgG3d = new ht.graph3d.Graph3dView();
                            bgG3d.deserialize(bgJSON);
                            bgG3d.addToDOM();
                            graphView.addToDOM(bgG3d.getView());
                        }
                        graphView.handleScroll = function() {};
                    }
                    debugger;
                    var a = dataModel.getDataByTag("radio");
                });
            }
			
			//创建node 
		function createNodes(dm) {
			//循环创建文本框node
			var startTime = '1541001600000';
			var windField = 17;
var endTime = '1541001660000';
			if(getQueryVariable('startTime') !== null){
				startTime = getQueryVariable('startTime');
			}
			if(getQueryVariable('windField') !== null){
				windField = getQueryVariable('windField');
			}
if(getQueryVariable('endTime') !== null){
                                endTime = getQueryVariable('endTime');
                        }
			var url = attributeConfig.url + "/epplatform/v1/weatherAnalyze/showAllLevel?startTime="+startTime+"&windField="+windField+"&endTime="+endTime;
			$.getJSON(url,function(result){
				for(var i=0;i<result.data.length;i++){
					if(result.data[i].label !== null && result.data[i].value !== null){
						var param = {
							"text" : result.data[i].text,
							"level" : result.data[i].level
						};
						var node = new ht.Node();
						//node.setLayer('1');
						node.setImage('symbols/涉网/richTextPane.json');
						node.a('ht.content',toContent(param));
						node.a('ht.background','#B2B2B2');
						node.a('ht.borderColor','#B2B2B2');
						node.setPosition((param.level-1)*215+50,45);//赋初始坐标
						node.s('2d.movable',false);
						if(param.level>0 && param.level<5){
							dm.add(node);
						}
					}
				}
			});
            //  return node;
        };
		//获取拼接参数
		function getQueryVariable(variable){
		   var query = window.location.search.substring(1);
		   var vars = query.split("&");
		   for (var i=0;i<vars.length;i++) {
			   var pair = vars[i].split("=");
			   if(pair[0] == variable){return pair[1];}
		   }
		   return null;
		}
		
		//转成文本框正文格式
		function toContent(obj){
			var content = 
			[[
				{
					"text" : obj.text,
					"color": "#FFFFFF",
					"font": "14px arial"
				}
			]]
			return content;
		}
        </script>
    </head>
    <body onload='setTimeout(init, 300)'>
    </body>
</html>
